﻿using Microsoft.Xna.Framework;

namespace Microsoft.Goldenlight.Framework.Scene
{
    /// <summary>
    /// 	Spatial database for tracking objects in the scene graph
    /// </summary>
    public class SceneContainer2D : LifetimeObject
    {
        #region Fields & Properties

        private SceneGraph2D _sceneGraph;

        /// <summary>
        /// 	Scene graph for which this is a scene container.
        /// </summary>
        public SceneGraph2D SceneGraph
        {
            get
            {
                return _sceneGraph;
            }
            set
            {
                _sceneGraph = value;
            }
        }

        #endregion

        #region Constructors

        /// <summary>
        /// </summary>
        /// <param name="sceneGraph"> </param>
        public SceneContainer2D(SceneGraph2D sceneGraph)
        {
            _sceneGraph = sceneGraph;
        }

        #endregion

        #region Overrides of LifetimeObject

        #region Implementation of IDisposable

        /// <summary>
        /// 	Releases all resources used by the Game class.
        /// </summary>
        /// <param name="disposing"> true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
        protected override void Dispose(bool disposing)
        {
            _isDisposed = true;
            if (disposing)
            {
            }
            base.Dispose(disposing);
        }

        #endregion

        #endregion

        #region Grid Operations

        #region Fields & Properties

        private float _cellSize;

        /// <summary>
        /// </summary>
        private float CellSize
        {
            get
            {
                return _cellSize;
            }
            set
            {
                _cellSize = value;
                _gridWidthSize = _gridWidth * _cellSize;
                _gridHeightSize = _gridHeight * _cellSize;
            }
        }

        private int _gridWidth;

        /// <summary>
        /// </summary>
        public int GridWidth
        {
            get
            {
                return _gridWidth;
            }
            set
            {
                _gridWidth = value;
                _gridWidthSize = _gridWidth * _cellSize;
            }
        }

        private int _gridHeight;

        /// <summary>
        /// </summary>
        public int GridHeight
        {
            get
            {
                return _gridHeight;
            }
            set
            {
                _gridHeight = value;
                _gridHeightSize = _gridHeight * _cellSize;
            }
        }

        private float _gridWidthSize;

        /// <summary>
        /// </summary>
        public float GridWidthSize
        {
            get
            {
                return _gridWidthSize;
            }
        }

        private float _gridHeightSize;

        /// <summary>
        /// </summary>
        public float GridHeightSize
        {
            get
            {
                return _gridHeightSize;
            }
        }

        #endregion

        #region Get Cells

        protected Rectangle GetCells(SceneObject2D sceneObject)
        {
            return new Rectangle();
        }

        #endregion

        #endregion

        #region Object Add & Remove

        public void AddSceneObject(SceneObject2D sceneObject)
        {
        }

        #endregion
    }
}